1. Field of the Invention
The present invention relates to an image data coding technique.
2. Description of the Related Art
In still-image and moving-image encoding, generally, image data is divided into rectangular tiles of a predetermined size, and each of the tiles is further divided into a plurality of macro blocks (MB) of a predetermined size. With the MB as a processing unit of encoding, data constituting the MB is subjected to orthogonal transformation, quantization, and coefficient prediction. After the coefficient prediction is performed, the data is further subjected to scan conversion for converting two-dimensional data to one-dimensional data consisting of a non-zero coefficient (non-zero data) and an zero coefficient (zero data), that is, a coefficient having zero run length. Based on one-dimensional data which has been rearranged in the foregoing manner, a plurality of syntax elements are generated, and each of the syntax elements is subjected to entropy coding. Finally, various codes generated by entropy coding are concatenated in a given order determined by each coding scheme, and code streams are generated.
In the above-described encoding, in which codes are generated respectively from a plurality of syntax elements and concatenated as a code stream, Japanese Patent Laid-Open No. 2006-157678 can be given as a coding apparatus which realizes encoding and concatenation at high speed.
Shown in FIG. 2 is a configuration of an image coding apparatus employing the above-described conventional art. The image coding apparatus comprises a block storage unit 201, N number of syntax element generation units 202-1 to 202-N, N number of code generation units 203-1 to 203-N, N number of variable-length code storage units 204-1 to 204-N, and a code concatenation unit 205.
In the image coding apparatus, transform coefficients are inputted in block unit and temporarily stored in the block storage unit 201. Since the block storage unit 201 has an alternate buffer architecture, which is capable of storing transform coefficients for at least two blocks, reading and writing in block unit can be performed in parallel. The N number of syntax element generation units 202-1 to 202-N generate a plurality of syntax elements in parallel based on the transform coefficients (image data) for one block, which are read out of the block storage unit 201. The N number of code generation units 203-1 to 203-N perform variable-length coding on the N number of generated syntax elements using a coding table. Each code, which has been generated by encoding by the N number of code generation units 203-1 to 203-N, is stored in the N number of variable-length code storage units 204-1 to 204-N according to the type of syntax elements. The code concatenation unit 205 concatenates each of the codes stored in the N number of variable-length code storage units 204-1 to 204-N and generates a code stream. Each of the N number of variable-length code storage units 204-1 to 204-N also has an alternate buffer architecture, which is capable of storing codes for at least two blocks.
The above-described configuration realizes an image coding apparatus, which is capable of pipelining encoding of a plurality of syntax elements and concatenation of respective codes in block unit, as well as high-speed encoding.
However, the image coding apparatus according to the conventional art has a problem in that processing performance of the apparatus depends upon the number of syntax elements. FIG. 3A shows a code storing method of each variable-length code storage unit, which constitutes the N number of variable-length code storage units 204-1 to 204-N. In each variable-length code storage unit, an encoded result (code) of a syntax element is stored in one address. Therefore, assuming that n number of syntax elements are generated by encoding transform coefficients for one block, the generated codes are stored in n number of addresses in the N number of variable-length code storage units 204, regardless of the amount of codes. The code concatenation unit 205 needs to read codes from n number of addresses in the variable-length code storage units 204-1 to 204-N in order to concatenate these codes. In other words, n times of reading must be performed regardless of the code length of each code data. As a result, the more the number of syntax elements (number of codes) in one block, the longer time is required for the code concatenation.
As described above, if the conventional art is applied to the JPEG XR coding scheme for encoding a large number of syntax elements, processing time for code concatenation increases, and thus the apparatus cannot benefit from the effect of encoding.